<html>
<%@ page import="java.util.*" %>
<%@ page import="Personal.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/datetime-1.0" prefix="dt" %>
<fmt:setBundle basename="hospital"/>
<html>
<head>

<style type="text/css">
     body, table, hr {
          color: black;
          background: silver;
          font-family: Verdana, sans-serif;
          vertical-align: top;
          font-size: medium;
     }
</style>
<body>

<c:set var="idIntake" value="${param.idIntake}" scope= "session"/>
<c:choose>
     <c:when test = "${idIntake!=null}" >
        <title><fmt:message key="intake.titleEdit"/></title>
        <h2><fmt:message key="intake.titleEdit"/></h2>
     </c:when>
     <c:otherwise>
        <title><fmt:message key="intake.titleAdd"/></title>
        <h2><fmt:message key="intake.titleAdd"/></h2>
     </c:otherwise>
 </c:choose>
<title><fmt:message key="intake.title"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


 <jsp:useBean id="sessionUser" scope="session" class="Doctor"/>
<c:set var="id" value="${param.id}" scope="session" />


<form method="post" action="addIntake.do">
<fmt:message key="doctor"/>:
   <select name="doctor">
     <c:choose>
         <c:when test = "${id!=null}" >
             <c:forEach var="doctor" items="${sessionUser.department.doctors}">
                <option value="${doctor.idPerson}">${doctor.name} from ${doctor.department.name}</option>
             </c:forEach>
         </c:when>
         <c:otherwise>
                <option value="${sessionUser.idPerson}">${sessionUser.name} from ${sessionUser.department.name}</option>
         </c:otherwise>
     </c:choose>
   </select>
   </br>
   </br>
   <fmt:message key="comment"/></br>
   <textarea rows="2" cols="60" name="comment">Input text</textarea>
   </br>
   </br>
<fmt:message key="patient"/>
   <select name="patient">
     <c:choose>
         <c:when test = "${id!=null}" >
                <option value="${id}">$id patient :${id}</option>
         </c:when>
         <c:otherwise>
            <c:forEach var="patient" items="${sessionUser.patients}">
                <option value="${patient.idPerson}">${patient.name}</option>
            </c:forEach>
         </c:otherwise>
     </c:choose>
   </select>

    The current time is:
    <dt:format pattern="MM/dd/yyyy hh:mm"><dt:currentTime/></dt:format>
   <p><fmt:message key="date"/></p>
   <table>
          <tr>
            <td><fmt:message key="year"/>:</td>
            <td><input type="text" size="10" name="year" value = "1995"></td>
          </tr>
          <tr>
            <td><fmt:message key="month"/>:</td>
            <td>
                <select name="month" width = "10">
                 <option value="Select">Select <dt:months id="mon" locale="true">
                 <option value="<jsp:getProperty name="mon" property="monthOfYear"/>"><jsp:getProperty name="mon" property="month"/></dt:months>
            </select>
            </td>
          </tr>
          <tr>
            <td><fmt:message key="day"/>:</td>
            <td><input type="text" size="10" name="day"></td>
          </tr>
          <tr>
            <td><fmt:message key="hour"/>:</td>
            <td><input type="text" size="10" name="hour"></td>
          </tr>
          <tr>
            <td><fmt:message key="minute"/>:</td>
            <td><input type="text" size="10" name="minute"></td>
          </tr>
   </table>

     <c:if test="${idIntake!=null}">
        Intake ID: <input type="text" size="3" name="idIntake" 	readonly = "readonly" value="${idIntake}"></input>
     </c:if>
     <input type="submit" name="addIntake" value=<fmt:message key="intake.submit"/>>

</form>
<table width=85% border=1 >
    <tr>
        <td vertical-align="top" width= "20%"><jsp:include page="DoctorsContacts.jsp" flush="true"/></td>
        <td width = "50%"><jsp:include page="DocTasksPage.jsp" flush="true"/></td>
    </tr>
</table>

</body>
</html>